#include "static.h"
#include "Wrappers\CSGD_TextureManager.h"
#include <d3dx9.h>
#include "Game Objects\CPlayer.h"


CDamageglitch::CDamageglitch()
{
	opacity = 0;
	IDs[0] = CSGD_TextureManager::GetInstance()->LoadTexture(".\\Resource\\Graphics\\static1.png");
	IDs[1] = CSGD_TextureManager::GetInstance()->LoadTexture(".\\Resource\\Graphics\\static2.png");
	IDs[2] = CSGD_TextureManager::GetInstance()->LoadTexture(".\\Resource\\Graphics\\static3.png");
	IDs[3] = CSGD_TextureManager::GetInstance()->LoadTexture(".\\Resource\\Graphics\\static4.png");

}

void CDamageglitch::update(float fElapsedTime)
{

	float health = (float)CPlayer::GetInstance()->gethealth();
	opacity =(int) (100.0f - (health * .01f) * 100.0f);
}

void CDamageglitch::render()
{
	CSGD_TextureManager::GetInstance()->Draw(IDs[rand() % 4], 0, 0, 1.0f, 1.0f, (RECT*)0, 0.0f, 0.0f, 0.0f, D3DCOLOR_ARGB(opacity, 0, 100, 0));
}